<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include  file="/jsps/front/common/taglibs.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">

	<link rel="stylesheet" type="text/css" href="<c:url value="/jsps/front/css/show.css"/>">
	<script type="text/javascript" src="<c:url value="/js/jquery.js"/>"></script>
	
	<script type="text/javascript">
		$(document).ready(function(){
			
			var lb = $("#limit-buy"),
				lb_cur = ${pagedGood.pageNo},
				lbp_w = lb.find(".products").width();
				lb_timer = null;
			    t = 1;
			function showLimitBuyProducts(){
				if(lb_cur < 1){
					lb_cur = ${pagedGood.totalPageNum};
				} else if(lb_cur > ${pagedGood.totalPageNum}){
					lb_cur = 1;
				}
				$("#J-lbcp").html(lb_cur);
				var products = $("#limit-buy .products").hide().eq(lb_cur-1).show(),
					ta = products.find("textarea");
					
				if(ta.length){
					products.html(ta.val());
				}
			}
			lb_timer = setInterval(function(){
				lb_cur++;
				showLimitBuyProducts();
				//location.href='<c:url value="/goodMgr?act=loadAll"/>&pageNo='+lb_cur;
			}, 4000);
			
			$("#J-lbn .prev, #J-lb .btn-prev").click(function(){
				lb_cur--;
				showLimitBuyProducts();
				location.href='<c:url value="/goodMgr?act=loadAll"/>&pageNo='+lb_cur;
			});
			$("#J-lbn .next, #J-lb .btn-next").click(function(){
			    lb_cur++;
				showLimitBuyProducts();
				location.href='<c:url value="/goodMgr?act=loadAll"/>&pageNo='+lb_cur;
			});
			$("#J-lb").hover(function(){
					clearInterval(lb_timer);
					lb_timer = null;
					$("#J-lb .btn-prev, #J-lb .btn-next").show();
				}, function(){
					lb_timer = setInterval(function(){
						lb_cur++;
						showLimitBuyProducts();
						//location.href='<c:url value="/goodMgr?act=loadAll"/>&pageNo='+lb_cur;
					}, 10000);
					$("#J-lb .btn-prev, #J-lb .btn-next").hide();
			});
			
		});
	</script>
 </head>
 	<div class="limit-box" id="J-lb">

		<div class="limit-buy-hd">
			<h2>限时抢购</h2>
			<div class="limit-buy-nav" id="J-lbn">
				<a href="javascript:void(0)" class="prev"></a>
				<span>
					<em id="J-lbcp">${pagedGood.pageNo}</em>/${pagedGood.totalPageNum}
				</span>
				<a href="javascript:void(0)" class="next"></a>
			</div>
		</div>

	<a href="javascript:void(0);" class="btn-prev"></a>
	
	<div class="limit-buy-bd" id="limit-buy">
	   <c:if test="${not empty pagedGood}">
		<ul class="products">
		     <c:forEach items="${pagedGood.pageContent}" var="good">
		      
		        <li>
				<p class="pic">
				  <a href="<c:url value="/goodMgr?act=showGood&goodNo=${good.goodsNo}"/>" target="_blank">
				    <img id=img title="商品图片" 
					    src="<c:url value="/goodMgr?act=showGoodCover"/>&goodNo=${good.goodsNo}" border=0></a></p>
				<p class="name"><a href="#" target="_blank">
				                     名称:${good.goodsName}<br>
				                     简介:${good.goodsMemo}</a></p>
				<p class="price">￥${good.goodsPrice}</p>
			</li>
			
		   </c:forEach>
		  </ul>
	   </c:if>
	  </div>
	  <a href="javascript:void(0);" class="btn-next"></a>
	</div>
  <body>
     
  </body>
</html>
